package com.tfswx.jcyw.ruleenginedesigner.dto.gzgl;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tfswx.ruleengine.compute.bean.HczdItem;
import com.tfswx.ruleengine.compute.enums.BdslxEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author Ricky
 * @date 2021/7/14
 */
@Data
public class BdsByBdsbmQueryOutputDTO {
    @ApiModelProperty(value = "")
    private String bdsbm;

    @ApiModelProperty(value = "")
    private String gzbm;

    @ApiModelProperty(value = "")
    private String bdsmc;

    @ApiModelProperty(value = "")
    private String bdsms;

    @ApiModelProperty(value = "")
    private String bds;

    @ApiModelProperty(value = "")
    private String hczd;

    @ApiModelProperty(value = "")
    private BdslxEnum bdslx;

    @ApiModelProperty(value = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date cjsj;

    public List<HczdItem> getHczdList() {
        if (StringUtils.isNotBlank(hczd)) {
            return JSON.parseArray(hczd).toJavaList(HczdItem.class);
        }
        return new ArrayList<>();
    }
}
